package com.lagou.service.impl;

import com.lagou.entity.Student;
import com.lagou.mapper.StudentMapper;
import com.lagou.service.StudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Resource
    private StudentMapper studentMapper;

    @Override
    public void add(Student student) {
        studentMapper.insert(student);
    }

    @Override
    public void del(Integer id) {
        studentMapper.deleteById(id);
    }

    @Override
    public void update(Student student) {
        studentMapper.updateById(student);
    }

    @Override
    public Student findById(Integer id) {
        return studentMapper.selectById(id);
    }

    @Override
    public List<Student> queryStudents() {
        return studentMapper.selectList(null);
    }
}
